﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

namespace YXShop.Web.membercenter.shop.shop_administer
{
    public partial class shop_affiche : System.Web.UI.Page
    {
        YXShop.BLL.Shop.Shop shopBll = new YXShop.BLL.Shop.Shop();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
               
                if (Session["MemberID"] != null)
                {
                    List<YXShop.Model.Shop.Shop> shopList = shopBll.GetListShopByWhere(" uid=" + Session["MemberID"].ToString());
                    if(shopList!=null&&shopList.Count==1)
                    {
                        ViewState["shop"] = shopList[0];
                        this.txtaffiche.Text = shopList[0].Discription.ToString();
                    }
                }
            }
       }
      
       protected void btnSave_Click(object sender, EventArgs e)
       {
           if(ViewState["shop"]!=null)
           {
               YXShop.Model.Shop.Shop shop = ViewState["shop"] as YXShop.Model.Shop.Shop;
               shop.Discription = this.txtaffiche.Text.Trim().ToString();
               int count=shopBll.Update(shop);
               if (count > 0)
               {
                   this.ltlMsg.Text = "操作成功,已修编辑该信息";
                   this.pnlMsg.Visible = true;
                   this.pnlMsg.CssClass = "actionOk";
               }
               else
               {
                   this.ltlMsg.Text = "操作失败";
                   this.pnlMsg.Visible = true;
                   this.pnlMsg.CssClass = "actionErr";
               }
           }
       }
    }
}
